/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DataAccess.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Domenico
 */
@Entity
@Table(name = "iva")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Iva.findAll", query = "SELECT i FROM Iva i"),
    @NamedQuery(name = "Iva.findByPercentualeIVA", query = "SELECT i FROM Iva i WHERE i.percentualeIVA = :percentualeIVA")})
public class Iva implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "percentualeIVA")
    private Integer percentualeIVA;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "iva")
    private Collection<Prodotto> prodottoCollection;

    public Iva() {
    }

    public Iva(Integer percentualeIVA) {
        this.percentualeIVA = percentualeIVA;
    }

    public Integer getPercentualeIVA() {
        return percentualeIVA;
    }

    public void setPercentualeIVA(Integer percentualeIVA) {
        this.percentualeIVA = percentualeIVA;
    }

    @XmlTransient
    public Collection<Prodotto> getProdottoCollection() {
        return prodottoCollection;
    }

    public void setProdottoCollection(Collection<Prodotto> prodottoCollection) {
        this.prodottoCollection = prodottoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (percentualeIVA != null ? percentualeIVA.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Iva)) {
            return false;
        }
        Iva other = (Iva) object;
        if ((this.percentualeIVA == null && other.percentualeIVA != null) || (this.percentualeIVA != null && !this.percentualeIVA.equals(other.percentualeIVA))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Business.Iva[ percentualeIVA=" + percentualeIVA + " ]";
    }
    
}
